package com.yuchen.ishop.service.dictionary;

import com.yuchen.ishop.entity.Dictionary;
import com.yuchen.jaxrs.restclient.RestClientUtils;
import com.yuchen.utils.config.ConfigUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import javax.ws.rs.core.GenericType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 */
@Service
public class DictionaryRestClient {

    private final static Logger LOG = Logger.getLogger(DictionaryRestClient.class);

    public  List<Dictionary> find(String dicKey){
        String url = ConfigUtils.config.get("dictionary_find");
        Map params = new HashMap(1);
        params.put("dicKey",dicKey);
        url =  RestClientUtils.url(url, params);
        GenericType genericType =  new GenericType<List<Dictionary>>() {};
        List<Dictionary> json = RestClientUtils.get(genericType,url);
        return json;
    }
}
